<?php
$subjectToAdmin = "Oktoberfest Vietnam Sponsorship Inquiry Confirmation";
$subjectToUser  = "Oktoberfest Vietnam Sponsorship Inquiry Confirmation";
$subjectToUser_vi  = "Xác nhận yêu cầu tài trợ Oktoberfest Việt Nam";
$userEmail  = $_POST["email"];
$adminEmail = "info@oktoberfestvietnam.com";

$mailbodyToAdmin = '
<html>
<head>
<title>Email booking from sponsor</title>
</head>
<body>
<table width="100%" border="1">
  <tr>
    <td colspan="2">Type sponsor: '.$_POST['typesponsor'].'</td>
  </tr>
  <tr>
    <td colspan="2">Company name: '.$_POST['company'].'</td>
  </tr>
  <tr>
    <td colspan="2">Contact name: '.$_POST['contactname'].'</td>
  </tr>
  <tr>
    <td>Title: '.$_POST['title'].'</td>
    <td>Address: '.$_POST['tel'].'</td>
  </tr>
  <tr>
    <td>Telephone: '.$_POST['fax'].'</td>
    <td>Mobile: '.$_POST['address'].'</td>
  </tr>
  <tr>
    <td>Fax: '.$_POST['mobile'].'</td>
    <td>Email: '.$_POST['email'].'</td>
  </tr>
</table>
</body>
</html>
';

$mailbodyToUser = '
<html>
<head>
<title>Thank you for become sponsor of Oktoberfet Vietnam 2013</title>
</head>
<body>
<p>Dear <b>'.$_POST["contactname"].'</b>,<br>
Thank you for your interest in applying to be a sponsor of Oktoberfest Vietnam 2013. A member of the organizing team will contact you shortly.<br><br>
Sincerely yours,<br>
The Oktoberfest Vietnam Organizers</p>
<table width="100%" border="1">
  <tr>
    <td colspan="2">Type sponsor: '.$_POST['typesponsor'].'</td>
  </tr>
  <tr>
    <td colspan="2">Company name: '.$_POST['company'].'</td>
  </tr>
  <tr>
    <td colspan="2">Contact name: '.$_POST['contactname'].'</td>
  </tr>
  <tr>
    <td>Title: '.$_POST['title'].'</td>
    <td>Address: '.$_POST['tel'].'</td>
  </tr>
  <tr>
    <td>Telephone: '.$_POST['fax'].'</td>
    <td>Mobile: '.$_POST['address'].'</td>
  </tr>
  <tr>
    <td>Fax: '.$_POST['mobile'].'</td>
    <td>Email: '.$_POST['email'].'</td>
  </tr>
</table>
</body>
</html>
';

$mailbodyToUser_vi = '
<html>
<head>
<title>Thank you for become sponsor of Oktoberfet Vietnam 2013</title>
</head>
<body>
<p>Thân gửi <b>'.$_POST["contactname"].'</b>,<br>
Cảm ơn quý vị đã tham gia tài trợ Lễ hội Oktoberfest Việt Nam 2013. Ban tổ chức sẽ sớm liên hệ với quý vị.<br><br>
Trân trọng,<br>
Ban tổ chức Lễ hội Oktoberfest</p>
<table width="100%" border="1">
  <tr>
    <td colspan="2">NHÀ TÀI TRỢ: '.$_POST['typesponsor'].'</td>
  </tr>
  <tr>
    <td colspan="2">TÊN CÔNG TY: '.$_POST['company'].'</td>
  </tr>
  <tr>
    <td colspan="2">NGƯỜI LIÊN HỆ: '.$_POST['contactname'].'</td>
  </tr>
  <tr>
    <td>CHỨC DANH: '.$_POST['title'].'</td>
    <td>ĐỊA CHỈ: '.$_POST['tel'].'</td>
  </tr>
  <tr>
    <td>ĐIỆN THOẠI: '.$_POST['fax'].'</td>
    <td>DI ĐỘNG: '.$_POST['address'].'</td>
  </tr>
  <tr>
    <td>FAX: '.$_POST['mobile'].'</td>
    <td>EMAIL: '.$_POST['email'].'</td>
  </tr>
</table>
</body>
</html>
';

$header = "mine-version: 1.0" . "\r\n";
$header .= "content-type:text/html;charset=utf-8" . "\r\n";// More headers
$header .= 'From: Oktoberfest Vietnam 2013 <info@oktoberfestvietnam.com>' . "\r\n";
$header .= 'bcc: siheng.tang@wmcvietnam.com' . "\r\n";
$header .= 'bcc: dinh.chau@wmcvietnam.com' . "\r\n";
$header .= 'bcc: nathan.kuehlthau@wmcvietnam.com' . "\r\n";
$header .= 'bcc: nhung.nguyen@wmcvietnam.com' . "\r\n";
$header .= 'bcc: nhan.nguyen@wmcvietnam.com' . "\r\n";
$header .= 'bcc: hung.phan@wmcvietnam.com' . "\r\n";
$header .= 'bcc: hung.nguyen@wmcvietnam.com' . "\r\n";
$header .= 'bcc: ai.pham@wmcvietnam.com' . "\r\n";



if(count($_POST) && !empty($_POST['contactname']) && !empty($_POST['mobile'])){
	
	mail($adminEmail, $subjectToAdmin, $mailbodyToAdmin, $header);
	if(isset($_POST['lang'])&& $_POST['lang'] == 'vi')
	{
		mail($userEmail, $subjectToUser_vi, $mailbodyToUser_vi, $header);
		header('Location: http://oktoberfestvietnam.com/cam-on/');
	}	
	else 
	{	
		
		
		mail($userEmail, $subjectToUser, $mailbodyToUser, $header);
		header('Location: http://oktoberfestvietnam.com/thank-you/');
	}
}
else {

	if(isset($_POST['lang'])&& $_POST['lang'] == 'vi')
	
		header('Location: http://oktoberfestvietnam.com/vi/');
		
	else header('Location: http://oktoberfestvietnam.com/en/');
}




?>

